package com.ruoyi.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.InventoryCheckMapper;
import com.ruoyi.inventory.domain.InventoryCheck;
import com.ruoyi.inventory.service.IInventoryCheckService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库存盘点Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class InventoryCheckServiceImpl implements IInventoryCheckService 
{
    @Autowired
    private InventoryCheckMapper inventoryCheckMapper;

    /**
     * 查询库存盘点
     * 
     * @param checkId 库存盘点主键
     * @return 库存盘点
     */
    @Override
    public InventoryCheck selectInventoryCheckByCheckId(Long checkId)
    {
        return inventoryCheckMapper.selectInventoryCheckByCheckId(checkId);
    }

    /**
     * 查询库存盘点列表
     * 
     * @param inventoryCheck 库存盘点
     * @return 库存盘点
     */
    @Override
    public List<InventoryCheck> selectInventoryCheckList(InventoryCheck inventoryCheck)
    {
        return inventoryCheckMapper.selectInventoryCheckList(inventoryCheck);
    }

    /**
     * 新增库存盘点
     * 
     * @param inventoryCheck 库存盘点
     * @return 结果
     */
    @Override
    public int insertInventoryCheck(InventoryCheck inventoryCheck)
    {
        inventoryCheck.setCreateTime(DateUtils.getNowDate());
        return inventoryCheckMapper.insertInventoryCheck(inventoryCheck);
    }

    /**
     * 修改库存盘点
     * 
     * @param inventoryCheck 库存盘点
     * @return 结果
     */
    @Override
    public int updateInventoryCheck(InventoryCheck inventoryCheck)
    {
        inventoryCheck.setUpdateTime(DateUtils.getNowDate());
        return inventoryCheckMapper.updateInventoryCheck(inventoryCheck);
    }

    /**
     * 批量删除库存盘点
     * 
     * @param checkIds 需要删除的库存盘点主键
     * @return 结果
     */
    @Override
    public int deleteInventoryCheckByCheckIds(String checkIds)
    {
        return inventoryCheckMapper.deleteInventoryCheckByCheckIds(Convert.toStrArray(checkIds));
    }

    /**
     * 删除库存盘点信息
     * 
     * @param checkId 库存盘点主键
     * @return 结果
     */
    @Override
    public int deleteInventoryCheckByCheckId(Long checkId)
    {
        return inventoryCheckMapper.deleteInventoryCheckByCheckId(checkId);
    }
}
